{extend name="ashippingguide/Public/base" /}
{block name="container"}
<script src="__STATIC__/layout/js/plugins/layer/laydate/laydate.js"></script>
<div class="page-heade">
    <h2 class="title_color text-center">导购劳动合同查询</h2>
</div>
<form action="" class="form-inline" id="form1" method="post">
    <table class="table table-bordered bud_hei">
        <tr>
            <td class="text-right">索引：</td>
            <td><input type="text" name="a_indexes"
                       value="<?php if(isset($where['a_indexes'])) echo $where['a_indexes']; ?>" class="form-control"></td>
            <td class="text-right">网点名称：</td>
            <td><input type="text" name="c_title"
                       value="<?php if(isset($where['c_title'])) echo $where['c_title']; ?>" class="form-control"></td>
            <td class="text-right">合同起始日：</td>
            <td>
                <div class="form-group">
                    <input type="text" id="start" class="form-control layer-date " style="min-width:120px;width:120px;display: inline-block;" name="a_fyDate" value="<?php if(isset($where['a_fyDate'])) echo $where['a_fyDate']; ?>">
                </div>
                <div class="form-group">
                    至
                </div>
                <div class="form-group">
                    <input type="text" class="form-control layer-date" style="min-width:120px;width:120px;display: inline-block;" id="end" name="a_fyDate1" value="<?php if(isset($where['a_fyDate1'])) echo $where['a_fyDate1']; ?>">
                </div>
            </td>
        </tr>
        <tr>
            <td class="text-right">甲方名称：</td>
            <td><input type="text" class="form-control" name="a_APartyName"
                       value="<?php if(isset($where['a_APartyName'])) echo $where['a_APartyName']; ?>"></td>
            <td class="text-right">乙方名称：</td>
            <td><input type="text" class="form-control" name="a_BPartyName"
                       value="<?php if(isset($where['a_BPartyName'])) echo $where['a_BPartyName']; ?>"></td>
            <td colspan="2">
                <button class="btn-sm btn-info btn" type="submit">查询</button><span class="lr_5"></span><button class="btn-sm btn-info btn" type="submit" id="reset">清空查询条件</button>
            </td>
        </tr>
        <tr>
            <td colspan="6" class="text-right"><input type="hidden" name="a_endDate" id="date" value=""><span class="colorRed" onclick="$('#date').val(1);$('#form1').submit();">请注意：未来两个月内即将到期劳动合同(请点击)</span></td>
        </tr>
    </table>
    <table class="table table-striped table-bordered table-hover bud_hei text-center" style="width: 100%;">
        <tr class="info">
            <th class="text-center">No.</th>
            <th class="text-center">索引</th>
            <th class="text-center">乙方姓名</th>
            <th class="text-center">岗位类型</th>
            <th class="text-center">甲方名称</th>
            <th class="text-center">乙方所属网点名称</th>
            <th class="text-center">合同起始日</th>
            <th class="text-center">合同到期日</th>
            <th class="text-center">签署<br>次数</th>
            <th class="text-center">已返回<br>合同</th>
            <th class="text-center">状态</th>
            <th class="text-center">操作</th>
        </tr>
        <tbody style="border: 0">
        {volist name="data" id="list"}
        <tr>
            <td>{$i}</td>
            <td>{$list.indexes}</td>
            <td>{$list.BPartyName}</td>
            <td>{$list.postType}</td>
            <td>{$list.APartyName}</td>
            <td class="text-left"><a href="/index/net/view/?id={$list.mainNet_id}"
                                     class="J_menuItem">{$list.mainNet}</a></td>
            <td>{$list.signDate}</td>
            <td>{$list.endDate}</td>
            <td>{$list.signNum}</td>
            <td>{$list.returnContract}</td>
            <td>{$list.state}</td>
            <td><a href="javascript:;" onclick="info({$list.id})" class="modify">详情</a>
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
    <h5 class="text-center" style="font-size: 13px;font-weight: 500">
        总共有{$count}条记录，第{$page}/{$maxpage}页,当前页<input id="page" name="pages" type="text" style="width: 40px" value=""/>
        <button id="gopage" type="submit">Go</button>&nbsp;&nbsp;<button id="fistpage" type="submit"
                                                                         onclick="$('#form1').find('input').val('');">首页
    </button>&nbsp;&nbsp;
        每页显示
        <select id="pagesize" name="limts">
            <option value='10'>10条</option>
            <option value='15'>15条</option>
            <option value='20'>20条</option>

        </select>
        <script>
            $('#pagesize').val("{$limit}");
        </script>
    </h5>
</form>
<div id="addlaborcontractDiv" class="ibox-content" style="display: none">
    <form action="" class="form-inline" id="form2">
        <table class="table table-bordered">
            <tr>
                <td style="width: 140px" class="text-center">索引<span class="colorRed">*</span></td>
                <td colspan="3" id="indexes"></td>
            </tr>
            <tr>
                <td class="text-center">合同名称<span class="colorRed">*</span></td>
                <td colspan="3" id="contractName"></td>
            </tr>
            <tr>
                <td class="text-center">甲方名称<span class="colorRed">*</span></td>
                <td id="APartyName">
                </td>
                <td class="text-center">乙方名称<span class="colorRed">*</span></td>
                <td id="BPartyName">
                </td>
            </tr>
            <tr>
                <td class="text-center">合同起始日<span class="colorRed">*</span></td>
                <td id="signDate"></td>
                <td class="text-center">合同到期日<span class="colorRed">*</span></td>
                <td id="endDate"></td>
            </tr>
            <tr>
                <td class="text-center">签署次数</td>
                <td id="signNum"></td>
                <td class="text-center">已返回合同</td>
                <td id="returnContract">
                </td>
            </tr>
            <tr>
                <td class="text-center">工作地点</td>
                <td id="workAddress"></td>
                <td class="text-center">合同性质</td>
                <td id="contractType">
                </td>
            </tr>
            <tr>
                <td class="text-center">合同通讯地址</td>
                <td colspan="3" id="address"></td>
            </tr>
            <tr>
                <td class="text-center">备注</td>
                <td colspan="3" id="des"></textarea></td>
            </tr>
        </table>
    </form>
</div>
<script>
    //日期范围限制
    var start = {
        elem: '#start',
        format: 'YYYY/MM/DD',
        min: '1970-01-01', //设定最小日期为当前日期
        max: '2099-06-16', //最大日期
        istime: true,
        istoday: false,
        choose: function (datas) {
            end.min = datas; //开始日选好后，重置结束日的最小日期
            end.start = datas //将结束日的初始值设定为开始日
        }
    };
    var end = {
        elem: '#end',
        format: 'YYYY/MM/DD',
        min: '1970-01-01',
        max: '2099-06-16',
        istime: true,
        istoday: false,
        choose: function (datas) {
            start.max = datas; //结束日选好后，重置开始日的最大日期
        }
    };
    laydate(start);
    laydate(end);
    $(document).ready(function () {
        $('#reset').on('click', function () {
            $("#form1 input").each(function () {
                $(this).val('');
            });
            $("#form1 select").each(function () {
                $(this).val('');
            });
            $('#form1').submit()
            return false
        })


    })

    function info(id) {
        $.get("{:url('ashippingguide/labourEdit')}", {id: id}, function (e) {
            $('#indexes').text(e.indexes);
            $('#contractName').text(e.contractName);
            $('#APartyName').text(e.APartyName);
            $('#BPartyName').text(e.BPartyName);
            $('#BPartyName_id').text(e.BPartyName_id);
            $('#signDate').text(e.signDate);
            $('#endDate').text(e.endDate);
            $('#signNum').text(e.signNum);
            var returnContract =  '';
            var contractType =  '';
            if(e.returnContract == 0){
                returnContract = '×';
            }else{
                returnContract = '√';
            }
            $('#returnContract').text(returnContract);
            $('#workAddress').text(e.workAddress);
            if(e.contractType == 1){
                contractType = '8小时工作制';
            }else if(e.contractType == 2){
                contractType = '不定时工作制';
            }else if(e.contractType == 3){
                contractType = '综合工时';
            }else{
                contractType = '未选择';
            }
            $('#contractType').text(contractType);
            $('#address').text(e.address);
            $('#des').text(e.des);
            layer.open({
                type: 1,
                title: '添加新合同',
                area: ['900px', '450px'],
                fixed: false, //不固定
                maxmin: true,
                content: $('#addlaborcontractDiv'),
            });
        }, 'json');
    }
</script>
{/block}